#include <stdio.h>

int my_strcmp(const char *s1, const char *s2)
{
    //找到两字符串不相同的字母
    while(*s1 != '\0' && *s2 != '\0' && *s1 == *s2)
    {
        s1++;
        s2++;
    }
    return *s1 - *s2;
}

int main(int argc, char const *argv[])
{
    char buffer1[] = {"hello"};
    char buffer2[] = {"words"};

    int x = my_strcmp(buffer1,buffer2);

    if(x > 0)
        printf("%s大于%s!",buffer1,buffer2);
    else if(x == 0)
        printf("两个字符串相等！");
    else 
        printf("%s小于%s!",buffer1,buffer2);

    return 0;
}
